<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>变量的运算</title>
    <script>
        function f1(){
            let num1 = 5;
            let num2 = 3;
            // console.log打印
            console.log(num1 + "+" + num2 + "=" + (num1 + num2));
            console.log(num1 + "-" + num2 + "=" + (num1 - num2));
            console.log(num1 + "*" + num2 + "=" + (num1 * num2));
            console.log(num1 + "/" + num2 + "=" + (num1 / num2));
            console.log(num1 + "%" + num2 + "=" + (num1 % num2));
            console.log(num1++)
            console.log(--num2)
            console.log(num1 += 2);
            console.log(num1 -= 2);
            console.log(num1 *= 2);
            console.log(num1 /= 2);
            console.log(num1 == num2);
            console.log(num1 > num2 && num2 > 5);
            console.log(num1 > num2 || num2 > 5);
            console.log(num1 > num2 ? "num1比num2大" : "num1小于等于num2")
            console.log(2 == "2");
        }
        function f2(){
            // 只比较值,不考虑类型
            console.log(2 == "2");
            // 恒等于:比较时要求值与类型都进行比较
            console.log(2 === "2");
            console.log(2 === 2);
        }
        function f3(){
            // 相当于Math.pow(2,3)
            // 二的三次方
            console.log(2 ** 3);
            console.log((-2) ** 3);
            console.log((-2) ** 4);
        }
    </script>
</head>
<body>
<button onclick="f1()">基本运算</button><br>
<button onclick="f2()">恒等于</button><br>
<button onclick="f3()">模方运算</button>
</body>
</html>